<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>Table</title>
		<link rel="stylesheet" href="../../plugins/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="../../css/global.css" media="all">
		<link rel="stylesheet" href="../../plugins/font-awesome/css/font-awesome.min.css">
		<link rel="stylesheet" href="../../css/table.css" />
	</head>

	<body>
		<div class="layui-form">
	  <table class="layui-table">
	    <thead>
	      <tr>
	        <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>
	        <th>人物</th>
	        <th>民族</th>
	        <th>出场时间</th>
	        <th>格言</th>
	      </tr> 
	    </thead>
	    <tbody>
	      <tr>
	        <td><input type="checkbox" name="" lay-skin="primary"></td>
	        <td>贤心</td>
	        <td>汉族</td>
	        <td>1989-10-14</td>
	        <td>人生似修行</td>
	      </tr>
	      <tr>
	        <td><input type="checkbox" name="" lay-skin="primary"></td>
	        <td>张爱玲</td>
	        <td>汉族</td>
	        <td>1920-09-30</td>
	        <td>于千万人之中遇见你所遇见的人，于千万年之中，时间的无涯的荒野里…</td>
	      </tr>
	    </tbody>
	  </table>
	</div>
	<script type="text/javascript" src="../../plugins/layui/lay/dest/layui.all.js"></script>
	<script type="text/javascript">
		var $ = layui.jquery,
			form = layui.form();
		//全选
		form.on('checkbox(allChoose)', function(data){
		    var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
		    child.each(function(index, item){
		      item.checked = data.elem.checked;
		    });
		    form.render('checkbox');
		});
	</script>
	</body>

</html>